﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CookComputing.XmlRpc;

namespace JeanFish.Blog.XmlRpc
{
    interface IWordPress
    {
        /// <summary>
        /// 获取用户的博客站点。
        /// </summary>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>用户博客站点</returns>
        [XmlRpcMethod("wp.getUsersBlogs",Description="获取用户的博客站点。")]
        BlogInfo[] GetUsersBlogs(string username, string password);
        /// <summary>
        /// 获取博客所属标签。
        /// </summary>
        /// <param name="blogId">博客站点编号。</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getTags", Description = "获取博客所属标签。")]
        Tag[] GetTags(string blogId, string username, string password);
        /// <summary>
        /// 获取博客作者列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getAuthors", Description = "获取博客作者列表。")]
        Author[] GetAuthors(string blogId, string username, string password);
        /// <summary>
        /// 获取博客设置项。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="options">查询的Option名称</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getOptions",Description="获取博客设置项。")]
        Option[] GetOptions(string blogId, string username, string password, params Option[] options);
        /// <summary>
        /// 设置博客设置项。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="options">查询的Option名称</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.setOptions",Description="设置博客设置项。")]
        Option[] SetOptions(string blogId, string username, string password, params Option[] options);
        /// <summary>
        /// 获取博文状态列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPostStatusList",Description="获取博文状态列表。")]
        PostStatus[] GetPostStatusList(string blogId, string username, string password);
        /// <summary>
        /// 获取博文格式。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="filters">格式过滤条件</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPostFormats", Description = "获取博文格式。")]
        PostFormat[] GetPostFormats(string blogId, string username, string password, params PostFormatsFilter[] filters);
        /// <summary>
        /// 获取博文评论列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="query">评论查询条件</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getComments", Description = "获取博文评论列表。")]
        Comment[] GetComments(string blogId, string username, string password, CommentQuery query);
        /// <summary>
        /// 获取博文评论统计。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="postId">博文编号</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getCommentCount", Description = "获取博文评论统计。")]
        CommentCount GetCommentCount(string blogId, string username, string password, string postId);
        /// <summary>
        /// 获取评论。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="commentId">评论编号</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getComment", Description = "获取评论。")]
        Comment GetComment(string blogId, string username, string password, int commentId);
        /// <summary>
        /// 删除评论。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="commentId">评论编号</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.deleteComment", Description = "删除评论。")]
        bool DeleteComment(string blogId, string username, string password, int commentId);
        /// <summary>
        /// 编辑评论。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="commentId">评论编号</param>
        /// <param name="comment">评论</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.editComment", Description = "编辑评论。")]
        bool EditComment(string blogId, string username, string password, int commentId, Comment comment);
        /// <summary>
        /// 新建评论。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="postId">博文编号</param>
        /// <param name="comment">评论</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.newComment", Description = "编辑评论。")]
        int NewComment(string blogId, string username, string password, int postId, Comment comment);
        /// <summary>
        /// 获取所有评论状态列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getCommentStatusList", Description = "获取所有评论状态列表。")]
        CommentStatus[] GetCommentStatusList(string blogId, string username, string password);
        /// <summary>
        /// 获取所有博文状态列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPageStatusList", Description = "获取所有博文状态列表。")]
        PageStatus[] GetPageStatusList(string blogId, string username, string password);
        /// <summary>
        /// 获取博文模版。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPageTemplates", Description = "获取博文模版。")]
        PageTemplate[] GetPageTemplates(string blogId, string username, string password);
        /// <summary>
        /// 获取博文。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="pageId">博文编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPage")]
        Page GetPage(string blogId, int pageId, string username, string password);
        /// <summary>
        /// 获取详细博文列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="maxPages">获取博文最大数量</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPages")]
        Page[] GetPages(string blogId, string username, string password, int maxPages = 10);
        /// <summary>
        /// 获取博文列表。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getPageList")]
        Page[] GetPageList(string blogId, string usernmae, string password);
        /// <summary>
        /// 新建博文。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="content">新博文内容</param>
        /// <param name="publish">创建后是否公开</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.newPage")]
        int NewPage(string blogId, string username, string password, Page content, bool publish);
        /// <summary>
        /// 删除博文。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="pageId">博文编号</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.deletePage")]
        bool DeletePage(string blogId, string username, string password, int pageId);
        /// <summary>
        /// 编辑博文。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="content">新博文内容</param>
        /// <param name="publish">编辑后是否公开</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.editPage")]
        int EditPage(string blogId, string username, string password, Page content, bool publish);
        /// <summary>
        /// 获取博客所有博文分类。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getCategories")]
        Category[] GetCategories(string blogId, string username, string password);
        /// <summary>
        /// 新建分类。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="category">新分类</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.newCategory")]
        int NewCategory(string blogId, string username, string password, Category category);
        /// <summary>
        /// 删除分类。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="categoryId">分类编号</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.deleteCategory")]
        bool DeleteCategory(string blogId, string username, string password, int categoryId);
        /// <summary>
        /// 根据分类名称推荐分类。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="category">分类名称</param>
        /// <param name="maxResult">最大返回结果数</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.suggestCategories")]
        SuggestedCategory[] SuggestCategories(string blogId, string username, string password, string category, int maxResult);
        /// <summary>
        /// 上传文件。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="data">文件数据</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.uploadFile")]
        FileInfo UploadFile(string blogId, string username, string password, FileData data);
        /// <summary>
        /// 获取媒体项目。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="attachmentId">附件编号</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getMediaItem")]
        MediaItem GetMediaItem(string blogId, string username, string password, int attachmentId);
        /// <summary>
        /// 获取媒体项目库。
        /// </summary>
        /// <param name="blogId">博客站点编号</param>
        /// <param name="username">用户名</param>
        /// <param name="password">密码</param>
        /// <param name="filer">媒体项目过滤条件</param>
        /// <returns></returns>
        [XmlRpcMethod("wp.getMediaLibrary")]
        MediaItem[] GetMediaLibrary(string blogId, string username, string password, MediaFilter filer = null);
    }
}
